home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 May / SGI IRIX 6.5 Complementary Applications 2004 May.iso / dist / OpenOffice.idb / usr / OpenOffice / help / en / sbasic.jar / text / sbasic / common / 03120304.xml < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-24  |  4.8 KB  |  53 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>LSet Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03120304"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         p.P2{
  7.                 }
  8.         span.T1{
  9.                 font-weight:bold;}
  10.         </style></head><body>
  11.   
  12.   
  13.   <help:to-be-embedded Eid="lset" xmlns:help="http://openoffice.org/2000/help">
  14.   <p class="Head1"><help:link Id="66409">LSet Statement [Runtime]</help:link></p>
  15.   <p class="Paragraph">Aligns a string to the left of a string variable, or copies a variable of a user-defined type to another variable of a different user-defined type.</p>
  16.   </help:to-be-embedded>
  17.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  18.   <p class="Paragraph">LSet Var As String = Text or LSet Var1 = Var2 <help:key-word value="LSet" tag="kw66409_1" xmlns:help="http://openoffice.org/2000/help"/></p>
  19.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  20.   <p class="Paragraph">Var: Any String variable, in which the string to be aligned to the left.</p>
  21.   <p class="Paragraph">Text: String to be aligned to the left of the string variable.</p>
  22.   <p class="Paragraph">Var1: Name of the user-defined type variable being copied to.</p>
  23.   <p class="Paragraph">Var2: Name of the user-defined type variable being copied from.</p>
  24.   <p class="Paragraph">If the string is shorter than the string variable, <span class="T1">LSet</span> left-aligns the string within the string variable. Any remaining positions in the string variable are replaced by spaces. If the string is longer than the string variable, only the leftmost characters up to the length of the string variable are copied. With the <span class="T1">LSet</span> statement, you can also copy a user-defined type variable to another variable of the same type.</p>
  25.   <p class="P2">Example:</p>
  26.   <p class="PropText">Sub ExampleRLSet</p>
  27.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim sVar As String</p>
  28.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Dim sExpr As String</p>
  29.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  30.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(40,"*")</p>
  31.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "SBX"</p>
  32.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>REM <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Align "SBX" within the 40-character reference string</p>
  33.   <p class="PropText">REM <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Replace asterisks with spaces</p>
  34.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>RSet sVar = sExpr</p>
  35.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  36.   <p class="PropText"/>
  37.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(5,"*")</p>
  38.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "123457896"</p>
  39.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>RSet sVar = sExpr</p>
  40.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  41.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  42.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(40,"*")</p>
  43.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "SBX"</p>
  44.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>REM Left-align "SBX" within the 40-character reference string</p>
  45.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>LSet sVar = sExpr</p>
  46.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"</p>
  47.   <p class="PropText"/>
  48.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sVar = String(5,"*")</p>
  49.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>sExpr = "123456789"</p>
  50.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>LSet sVar = sExpr</p>
  51.   <p class="PropText"><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>Print ">"; sVar; "<"<text:tab-stop xmlns:text="http://openoffice.org/2000/text"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/></p>
  52.   <p class="PropText">End Sub</p>
  53.  </body></html>